#ifndef VECTOR2_H
#define VECTOR2_H

#include <iostream>
#include <math.h>

class Vector2{
private:
    double x_, y_;
public:
    Vector2(double x, double y);

    static Vector2 angleToVector(const double angle);

    const bool operator==(const Vector2& other) const;
    inline const bool operator!=(const Vector2& other) const;

    const Vector2 operator+() const;
    const Vector2 operator-() const;

    Vector2& operator+=(const Vector2& other);
    const Vector2 operator+(const Vector2& other) const;

    Vector2& operator-=(const Vector2& other);
    const Vector2 operator-(const Vector2& other) const;

    Vector2& operator*=(const double s);
    const Vector2 operator*(const double s) const;
    friend const Vector2 operator*(const double s, const Vector2& vec);

    Vector2& operator/=(const double s);
    const Vector2 operator/(const double s) const;

    //dot product
    const double operator*(const Vector2& other) const;

    friend std::ostream& operator<<(std::ostream& os, const Vector2& v);

    const double magnitude() const;

    void normalize();

    const Vector2 normalized() const;

    const double& getX() const;
    const double& getY() const;

    const double angle() const;
};

std::ostream& operator<<(std::ostream& os, const Vector2& v);

Vector2 const operator*(const double s, const Vector2& vec);

#endif
